<?php
if(!class_exists('Ekotest')){
	class Ekotest{
     /**
     * Initializer for setting up action handler
     */
    public static function init() {
        self::prefix_activation;
        add_filter('the_title', array( get_called_class(), 'addtext' ) );
        add_action('wp_enqueue_scripts',array(get_called_class(),'js_extend'));
    }

	 public static function prefix_activation(){

        add_option('plugintest','666666'); 

	 }
     
     public static function prefix_deactivation(){
        delete_option('plugintest');
     }

     public function addtext($title){
        if(is_single()){
     	   //echo $res;die;
        	$str = get_option('testname');
            $str = "<span class='ekolin'>".$str."</span>";
           return $title.$str;
        }   
     	 
     }

	 public static function js_extend(){
         //全局加载js脚本
        //wp_enqueue_script( 'js_scripts',plugin_dir_url( __FILE__ ) . '/', array( 'jquery' ), '1.01',true );
        wp_enqueue_script( 'js_scripts', plugins_url( '/js/function.js' , __FILE__ ), array( 'jquery' ), time(),true );
     }    


	}
}